package com.hiwhitley.leetcode.hard;

/**
 * Created by hiwhitley on 16-12-30.
 */
public class ContainerWithMostWater_11 {
    public static int maxArea(int[] arr) {

        int l = 0;
        int r = arr.length - 1;
        int res = Integer.MIN_VALUE;
        while (l < r) {
            if (arr[l] < arr[r]) {
                res = Math.max(res, (r - l) * arr[l++]);
            } else {
                res = Math.max(res, (r - l) * arr[r--]);
            }
        }
        return res;
    }

    public static void main(String[] args) {
        int[] a = {1, 1};
        int max = maxArea(a);
        System.out.println(max);
    }
}
